package org.snail.message.service.impl;

import com.alibaba.fastjson.JSON;
import lombok.extern.log4j.Log4j;
import org.apache.activemq.ScheduledMessage;
import org.snail.activemq.PushService;
import org.snail.department.service.message.DeptInfoMessageCreator;
import org.snail.message.service.message.GroupMessageCreator;
import org.snail.other.bean.GroupNotificationDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Service;

import javax.jms.*;

@Service
@Log4j
public class GroupMessagePushService implements PushService {

    @Autowired
    private JmsTemplate jmsTemplate;
    @Autowired
    @Qualifier("groupMessageSenderQueue")
    private Destination destination;
    @Autowired
    private GroupMessageCreator groupMessageCreator;

    @Override
    public void push(Object object) {
        groupMessageCreator.setSendObject(object);

        //推送消息到队列
        pushExecutor.execute(groupMessageCreator);
    }
}